/*******************************************************************
 * author   :  Charlies-ls
 * Date     :  2021-09-26
 * Copyright (c) 2021. artestplay@outlook.com. All Rights Reserved.
 *******************************************************************/

#include "ax_dict.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "com.h"
#include "ax_printf.h"



ax_dict* ax_dict_create(AX_HT_FLAGS flags)
{
    return ax_hashtable_create(flags);
}

void ax_dict_destory(ax_dict*h)
{
    ax_hashtable_destory(h);
}

void ax_dict_insert(ax_dict*d,const char* key, const void* value)
{
    ax_hashtable_insert(d, key, strlen(key)+1, value, sizeof(void*));
}

void* ax_dict_get(ax_dict*d,const char*key)
{
    return ax_hashtable_get(d, key, strlen(key)+1, NULL);
}

bool ax_dict_remove(ax_dict*d,const char*key)
{
    return ax_hashtable_remove(d, key, strlen(key)+1);
}

bool ax_dict_contains(ax_dict*d,const char* key)
{
    return ax_hashtable_contains(d, key, strlen(key));
}

uint32_t ax_dict_size(ax_dict* table)
{
    return ax_hashtable_size(table);
}

void ax_dict_clear(ax_dict* table)
{
    return ax_hashtable_clear(table);
}

void* ax_dict_entry_get_key(void* entry)
{
    return ax_hashtable_entry_get_key(entry);
}

void* ax_dict_entry_get_value(void* entry)
{
    return ax_hashtable_entry_get_value(entry);
}

void* ax_dict_get_head(ax_dict* table)
{
    return ax_hashtable_get_head(table);
}
